//导入 mongoose
const mongoose = require('mongoose');
//创建文档的结构对象
//设置集合中文档的属性以及属性值的类型
let Salary = new mongoose.Schema({
  // 员工姓名
  name: {
    type: String,
    default: null,
  },
  // 基本工资
  baseSalary: {
    type: Number,
    default: 0,  
  },
  // 岗位工资
  positionSalary: {
    type: Number,
    default: 0,  
  },
  //绩效工资
  performanceSalary: {
    type: Number,
    default: 0,  
  },
  //司龄工资
  senioritySalary: {
    type: Number,
    default: 0, 
  },
  // 养老保险
  pension: {
    type: Number,
    default: 0,  
  },
  // 医疗保险
  medicalInsurance: {
    type: Number,
    default: 0,
  },
  addTime: {
    type: Date,
    default: new Date(),
  },
});

//创建模型对象  对文档操作的封装对象
let SalaryModel = mongoose.model('Salary', Salary);

//暴露模型对象
module.exports = SalaryModel;
